<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html" ; charset="utf-8" />
    <title>学历查询</title>
    <link href="../../../css/main.css" rel="stylesheet" type="text/css" />
    <link
      href="../../../bstable/css/bootstrap.min.css"
      rel="stylesheet"
      type="text/css"
    />
    <link
      href="../../../bstable/css/bootstrap-table.css"
      rel="stylesheet"
      type="text/css"
    />

    <style>
      .bootstrap-table {
        padding: 20px;
      }

      .dialog-form {
        width: 350px;
      }

      .dialog-form .form_input {
        width: 70%;
      }

      .dialog-form .form-control {
        width: 70%;
        display: inline-block;
      }

      .dialog-form .p_line {
        border: none;
      }
      .tabe_div .find_a,
      .tabe_div .form_input,
      .tabe_div .form_select {
        display: none;
      }
    </style>
  </head>

  <body>
    <div class="tabe_div">
      <p class="p_line text_ient" style="margin-bottom: -10px">
        <a class="find_a" id="xl-label1">学习形式：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 200px; background: #fff"
          id="xl-field1"
        ></select>
        <a class="find_a" id="xl-label2">学历层次：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 200px; background: #fff"
          id="xl-field2"
        ></select>
        <a class="find_a" id="xl-label3">学校：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 200px; background: #fff"
          id="xl-field3"
        ></select>
        <a class="find_a" id="xl-label4">专业：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 200px; background: #fff"
          id="xl-field4"
        ></select>
        <!-- // -->
        <a class="find_a" id="zy-label1">职业技能类别：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 210px; background: #fff"
          id="zy-field1"
        ></select>
        <a class="find_a" id="zy-label2">职业专业：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 210px; background: #fff"
          id="zy-field2"
        ></select>
        <!-- // -->
        <a class="find_a" id="zc-label1">职称等级：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 210px; background: #fff"
          id="zc-field1"
        ></select>
        <a class="find_a" id="zc-label2">职称系列：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 210px; background: #fff"
          id="zc-field2"
        ></select>
        <a class="find_a" id="zc-label3">职称专业：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 210px; background: #fff"
          id="zc-field3"
        ></select>
        <!-- // -->
        <a class="find_a" id="zhy-label1">项目：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 210px; background: #fff"
          id="zhy-field1"
        ></select>
        <a class="find_a" id="zhy-label2">科目：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 210px; background: #fff"
          id="zhy-field2"
        ></select>
        <a class="find_a" id="zhy-label3">报考类型：</a>
        <select
          class="form_select pxbk-select"
          style="padding-left: 1%; width: 210px; background: #fff"
          id="zhy-field3"
        ></select>
        <input
          style="float: right; margin-right: 20px; padding: 8px 25px"
          type="button"
          value="查询"
          class="but_find"
          id="search"
        />
      </p>
      <table
        data-url="json/data_alae_list.json"
        id="table"
        class="table_style"
        style="margin: 0 auto"
      ></table>
    </div>
    <script src="../../../js/jquery.js"></script>
    <script src="../../../js/common.js"></script>
    <script src="../../../js/date/js/laydate.js"></script>
    <script src="../../../bstable/js/bootstrap.min.js"></script>
    <script src="../../../bstable/js/bootstrap-table.js"></script>
    <script src="../../../bstable/js/bootstrap-table-zh-CN.min.js"></script>
    <script src="../../../layer_v2.1/layer/layer.js"></script>
    <script type="text/javascript">
      //配置
      function config(typeName) {
        let customHTML = '';
        if (typeName === 'xl') {
          customHTML = `<p class="col lx-col-50">
                                <a class="find_a">学历层次：&nbsp;</a>
                                <input id="group_name" type="text" maxlength="11" style="width: 66%;" class="form_input text_ient" placeholder="" disabled />
                            </p>
                            <p class="col lx-col-50">
                                <a class="find_a">
                                  学校名称：</a>
                                <input id="zg_tel" type="text" maxlength="11" style="width: 66%;" class="form_input text_ient" placeholder="" oninput="getSupervisorNameByTel(this)" disabled />
                            </p>
                            <p class="col lx-col-50">
                                <a class="find_a">
                                  专业：&nbsp;</a>
                                <input type="text" maxlength="10" class="form_input text_ient" placeholder="" disabled />
                            </p>`;
        } else if (typeName === 'zy') {
          customHTML = `<p class="col lx-col-50">
                                <a class="find_a">职业技能类别：&nbsp;</a>
                                <input id="group_name" type="text" maxlength="11" style="width: 66%;" class="form_input text_ient" placeholder="" disabled />
                            </p>
                            <p class="col lx-col-50">
                                <a class="find_a">
                                  职业专业：</a>
                                <input id="zg_tel" type="text" maxlength="11" style="width: 66%;" class="form_input text_ient" placeholder="" oninput="getSupervisorNameByTel(this)" disabled />
                            </p>`;
        } else if (typeName === 'zc') {
          customHTML = `<p class="col lx-col-50">
                                <a class="find_a">职称等级：&nbsp;</a>
                                <input id="group_name" type="text" maxlength="11" style="width: 66%;" class="form_input text_ient" placeholder="" disabled />
                            </p>
                            <p class="col lx-col-50">
                                <a class="find_a">职称系列：</a>
                                <input id="zg_tel" type="text" maxlength="11" style="width: 66%;" class="form_input text_ient" placeholder="" oninput="getSupervisorNameByTel(this)" disabled/>
                            </p>
                            <p class="col lx-col-50">
                                <a class="find_a">
                                  职称专业：&nbsp;</a>
                                <input type="text" maxlength="10" class="form_input text_ient" placeholder="" disabled />
                            </p>`;
        } else {
          customHTML = `<p class="col lx-col-50">
                                <a class="find_a">项目：&nbsp;</a>
                                <input id="group_name" type="text" maxlength="11" style="width: 66%;" class="form_input text_ient" placeholder="" disabled />
                            </p>
                            <p class="col lx-col-50">
                                <a class="find_a">科目：</a>
                                <input id="zg_tel" type="text" maxlength="11" style="width: 66%;" class="form_input text_ient" placeholder="" oninput="getSupervisorNameByTel(this)" disabled/>
                            </p>
                            <p class="col lx-col-50">
                                <a class="find_a">
                                  报考类型：&nbsp;</a>
                                <input type="text" maxlength="10" class="form_input text_ient" placeholder="" disabled />
                            </p>`;
        }
        layerOpen(customHTML);
      }
      $(function () {
        const typeName = getQuery('type');
        $('#search').on('click', function () {
          $('#table').bootstrapTable('refresh');
        });
        var perm = JSON.parse(localStorage.getItem('userInfo')).perm;

        const indexColumn = {
          field: 'no',
          title: '序号',
          // sortable: true,
          width: '120',
          align: 'center',
          formatter: function (value, row, index) {
            return index + 1;
          },
        };
        // 业绩计算比例
        const operateColumn = [
          {
            title: '业绩计算比例',
            field: 'trainName',
            align: 'center',
            valign: 'middle',
          },
          {
            title: '业绩计算时间',
            field: 'trainName',
            align: 'center',
            valign: 'middle',
          },
          {
            title: '创建时间',
            field: 'trainName',
            align: 'center',
            valign: 'middle',
          },
          {
            title: '操作',
            field: 'id',
            align: 'center',
            width: '160',
            formatter: function (value, row) {
              const a = `<a href="#" onclick="config('${typeName}')">配置</a>`;
              return a;
            },
          },
        ];

        let api,
          columns = '';
        let body = {};

        switch (typeName) {
          case 'xl':
            $('#xl-label1').show();
            $('#xl-field1').show();
            $('#xl-label2').show();
            $('#xl-field2').show();
            $('#xl-label3').show();
            $('#xl-field3').show();
            $('#xl-label4').show();
            $('#xl-field4').show();
            localStorage.setItem('name', '财务管理/学历提升业绩配置');
            api = 'education/queryTrainList';
            columns = [
              indexColumn,
              {
                title: '学习形式',
                field: 'trainName',
                align: 'center',
                valign: 'middle',
              },
              {
                title: '学历层次',
                field: 'trainName',
                align: 'center',
                valign: 'middle',
              },
              {
                title: '学校',
                field: 'trainName',
                align: 'center',
                valign: 'middle',
              },
              {
                title: '专业名称',
                field: 'supervisorsName',
                align: 'center',
              },
              ...operateColumn,
            ];
            break;
          case 'zy':
            $('#zy-label1').show();
            $('#zy-field1').show();
            $('#zy-label2').show();
            $('#zy-field2').show();
            localStorage.setItem('name', '财务管理/职业技能业绩配置');
            api = 'education/queryTrainInfoList';
            body = { trainId: '' };
            columns = [
              indexColumn,
              {
                title: '职业技能类别',
                field: 'trainName',
                align: 'center',
                valign: 'middle',
              },
              {
                title: '职业专业',
                field: 'trainName',
                align: 'center',
                valign: 'middle',
              },
              ...operateColumn,
            ];
            break;
          case 'zc':
            $('#zc-label1').show();
            $('#zc-field1').show();
            $('#zc-label2').show();
            $('#zc-field2').show();
            $('#zc-label3').show();
            $('#zc-field3').show();
            localStorage.setItem('name', '财务管理/职称评审业绩配置');
            api = 'education/queryClasssList';
            body = { occupationId: '1328158867200225281' };
            columns = [
              indexColumn,
              {
                title: '职称等级',
                field: 'classs',
                align: 'center',
                valign: 'middle',
              },
              {
                title: '职称系列',
                field: 'supervisorsName',
                align: 'center',
              },
              {
                title: '职称专业',
                field: 'supervisorsName',
                align: 'center',
              },
              ...operateColumn,
              ,
            ];
            break;
          default:
            $('#zhy-label1').show();
            $('#zhy-field1').show();
            $('#zhy-label2').show();
            $('#zhy-field2').show();
            $('#zhy-label3').show();
            $('#zhy-field3').show();
            localStorage.setItem('name', '财务管理/执业资格业绩配置');
            api = 'education/queryClasssList';
            body = { occupationId: '1328158867200225281' };
            columns = [
              indexColumn,
              {
                title: '项目',
                field: 'classs',
                align: 'center',
                valign: 'middle',
              },
              {
                title: '科目',
                field: 'supervisorsName',
                align: 'center',
              },
              {
                title: '报考类型',
                field: 'supervisorsName',
                align: 'center',
              },
              ...operateColumn,
              ,
            ];
        }

        loadTableData(api, columns);

        function loadTableData(api, columns) {
          $('#table').bootstrapTable({
            method: 'post',
            striped: true,
            singleSelect: false,
            url: baseUrl + api,
            dataType: 'json',
            sidePagination: 'server',
            pagination: false, //分页
            search: false, //显示搜索框
            queryParamsType: '',
            contentType: 'application/x-www-form-urlencoded',
            ajaxOptions: {
              headers: {
                Authorization: JSON.parse(localStorage.getItem('userInfo'))
                  .token,
              },
            },
            queryParams: function (params) {
              // const formData = new FormData();
              // formData.append('occupationId', '1328158867200225281');
              // return formData;
              return { ...body };
            },
            responseHandler: function (res) {
              var list = res;
              return {
                rows: list,
                total: res.length,
              };
            },
            columns: columns,
          });
        }
      });

      Date.prototype.Format = function (fmt) {
        // author: meizz
        var o = {
          'M+': this.getMonth() + 1, // 月份
          'd+': this.getDate(), // 日
          'h+': this.getHours(), // 小时
          'm+': this.getMinutes(), // 分
          's+': this.getSeconds(), // 秒
          'q+': Math.floor((this.getMonth() + 3) / 3), // 季度
          S: this.getMilliseconds(), // 毫秒
        };
        if (/(y+)/.test(fmt))
          fmt = fmt.replace(
            RegExp.$1,
            (this.getFullYear() + '').substr(4 - RegExp.$1.length)
          );
        for (var k in o)
          if (new RegExp('(' + k + ')').test(fmt))
            fmt = fmt.replace(
              RegExp.$1,
              RegExp.$1.length == 1
                ? o[k]
                : ('00' + o[k]).substr(('' + o[k]).length)
            );
        return fmt;
      };
      var getTime = function getTime() {
        return new Date().Format('yyyy-MM-dd');
      };

      //type 1新增  2修改
      function layerOpen(customHTML) {
        var html = `<div class="dialog-form"><div class="p_line text_ient lx-row">
                                        <p class="col lx-col-50">
                                <a class="find_a">创建时间：</a>
                                ${getTime()}
                            </p>
                                        ${customHTML}
                                        <p class="col lx-col-50">
                                <a class="find_a">业绩计算比例：</a>
                                <input type="text" style="width: 45%;" class="form_input text_ient" placeholder="" oninput="getSupervisorNameByTel(this)"/>
                            </p>
                                        <p class="col lx-col-50">
                                <a class="find_a">业绩计算时间：</a>
                                <select
          class="form_select pxbk-select"
        >
        <option value="取证后计算">取证后计算</option>
        <option value="审核后计算">审核后计算</option>
        </select>
                            </p>
                        </div></div>`;
        layer.open({
          title: '修改',
          type: 1,
          // closeBtn: 0, //不显示关闭按钮
          anim: 2,
          yes: function (index, layero) {
            //do something
            // console.log(index, layero);
            // layer.close(index); //如果设定了yes回调，需进行手工关闭
          },
          btn: ['保存'],
          // shadeClose: true, //开启遮罩关闭
          content: html,
        });
      }
      function rowStyle(item, index) {
        style = item.colorFlag == 1 ? { css: { color: '#ed5565' } } : {};
        return style;
      }
    </script>
  </body>
</html>
